package com.xuecheng.ucenter.feignclient.fallback;

import com.xuecheng.ucenter.feignclient.CheckCodeClient;
import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

/**
 * @author shiminghui
 * @date 2024/9/8 11:10
 * @description: TODO
 */
@Component
@Slf4j
public class CheckCodeClientFactory implements FallbackFactory<CheckCodeClient> {
    @Override
    public CheckCodeClient create(Throwable throwable) {
        return new CheckCodeClient() {
            @Override
            public Boolean verify(String key, String code) {
                log.error("验证码校验失败,走了熔断降级流程", throwable);
                return false;
            }
        };
    }
}
